package xyz.xtt.activity.entity;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 * NFT碎片表
 * </p>
 *
 * @author dale
 * @since 2025-01-16
 */
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Accessors(chain = true)
@TableName("tbl_fragment")
@ApiModel(value = "TblFragment对象", description = "nft碎片表")
public class TblFragment implements Serializable {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "主键id")
	@TableId(value = "fragment_id", type = IdType.AUTO)
	private Long fragmentId;
	@Min(0)
	@Max(6)
	@ApiModelProperty(value = "碎片key")
	private Integer fragmentKey;

	@ApiModelProperty(value = "所属活动id")
	private Long activityId;

	@ApiModelProperty(value = "NFT碎片名称")
	private String name;

	@ApiModelProperty(value = "碎片描述信息")
	private String remark;

	@ApiModelProperty(value = "创建时间")
	private Long createTime;

	@ApiModelProperty(value = "更新时间")
	private Long updateTime;

	public static TblFragment buildInit(Integer fragmentKey, String name, String desc, Long activityId) {
		return TblFragment
				.builder()
				.fragmentId(IdUtil.getSnowflakeNextId())
				.fragmentKey(fragmentKey)
				.activityId(activityId)
				.name(name)
				.remark(desc)
				.createTime(System.currentTimeMillis())
				.updateTime(System.currentTimeMillis())
				.build();
	}
}
